package com.dyna.mapper;

import com.dyna.core.LambdaQueryWrapperX;
import com.dyna.domain.resp.PageResult;
import com.dyna.foundation.domain.entity.SysTenantPackage;
import com.dyna.foundation.domain.req.SysTenantPackagePageReq;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SysTenantPackageMapper extends BaseMapperX<SysTenantPackage> {

    default PageResult<SysTenantPackage> selectPage(SysTenantPackagePageReq reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SysTenantPackage>()
                .likeIfPresent(SysTenantPackage::getName, reqVO.getName())
                .eqIfPresent(SysTenantPackage::getStatus, reqVO.getStatus())
                .likeIfPresent(SysTenantPackage::getRemark, reqVO.getRemark())
                .betweenIfPresent(SysTenantPackage::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SysTenantPackage::getId));
    }

    default List<SysTenantPackage> selectListByStatus(Integer status) {
        return selectList(SysTenantPackage::getStatus, status);
    }



    default SysTenantPackage selectByName(String name) {
        return selectOne(SysTenantPackage::getName, name);
    }

}